package com.ruoyi.Course.mapper;

import com.ruoyi.Course.domian.entity.CourseStudentEntity;
import com.ruoyi.Course.domian.entity.CourseTeacherEntity;
import com.ruoyi.teacherInformation.domain.Teacher;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Options;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

public interface courseMapper {
    /**
     * 根据教师id查询教师信息
     * @param teacherId
     * @return
     */
    @Select("select * from d_teacher where teacher_id=#{teacherId}")
    public Teacher selectTeacherByTeacherId(String teacherId);

    /**
     * 插入教师课程信息
     * @param courseTeacherEntity
     * @return
     */
    @Insert("insert into d_course_teacher(course_id,course_name,teacher_dept,teacher_name,teacher_id,sum_cnt,select_cnt,class_dept,classes,week,week_type,period,place,weekday,grop)" + "values(#{courseId},#{courseName},#{teacherDept},#{teacherName},#{teacherId},#{sumCnt},#{selectCnt},#{classDept},#{classes},#{week},#{weekType},#{period},#{place},#{weekday},#{grop})")
    @Options(useGeneratedKeys = true, keyProperty = "id")
    public int insertTeacherCourse(CourseTeacherEntity courseTeacherEntity);

    /**
     * 插入学生课程信息
     * @param courseStudentEntity
     * @return
     */
    @Insert("insert into d_course_student(student_id,student_name,course_id,course_name,teacher_name,week,weektype,weekday,period,place,class_name,course_teacher_id)"+
            "values(#{studentId},#{studentName},#{courseId},#{courseName},#{teacherName},#{week},#{weektype},#{weekday},#{period},#{place},#{className},#{courseTeacherId})")
    public int insertStudentCourse(CourseStudentEntity courseStudentEntity);

    /**
     * 根据课程名和教师id查询教师课程信息
     * @param courseName
     * @param teacherId
     * @return
     */
    @Select("select * from d_course_teacher where course_name=#{courseName} and teacher_id=#{teacherId}")
    public List<CourseTeacherEntity> selectCourseTeacherByCourseNameAndTeacherId(@Param("courseName") String courseName,@Param("teacherId") String teacherId);
}